package com.james.util;

import com.james.bean.SysUser;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;

/**
 * @author ：zhz
 * @date ：2022/7/8 8:55
 * @description：TODO
 * @version: 1.0
 */
public class UserUtil {

    /**
     * 当前用户信息
     * @return
     */
    public static UserDetails getUser(){
        UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return userDetails;
    }
}
